package com.ahsh1688.zhengshi;

import com.ahsh1688.zhengshi.window.LoginWindow;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.swing.*;
import java.awt.*;

@SpringBootApplication
public class ZhengshiApplication {

    public static void main(String[] args) {

        SpringApplication.run(ZhengshiApplication.class, args);

        LoginWindow win = new LoginWindow();
        int windowWidth = 350;//定义宽高
        int windowHeight = 210;
        win.setTitle("登录");
        ImageIcon icon = new ImageIcon("src\\main\\java\\com\\ahsh1688\\zhengshi\\window\\images\\logo.png");
        win.setIconImage(icon.getImage());
        win.setSize(windowWidth,windowHeight);//窗体大小
        //ts.setLocation(500,300);//静态窗体出现的位置
        Toolkit defaultToolkit = Toolkit.getDefaultToolkit();//调用Toolkit接口
        Dimension screenSize = defaultToolkit.getScreenSize();//获取screen的大小
        //先定义宽高，用当前屏幕大小减去自定义的宽高，再除以2就是居中的位置
        win.setLocation((screenSize.width - windowWidth) / 2,(screenSize.height - windowHeight) / 2);
        win.setResizable(false);//窗口锁死
        win.setDefaultCloseOperation(win.EXIT_ON_CLOSE);//关闭时退掉进程

        win.setVisible(true);//让窗口显示出来

    }
}
